<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace api\user\validate;

use think\Validate;

class InvoiceValidate extends Validate
{
    protected $rule = [
        'title'        =>  'require|unique:device',
	    'dentify_number'      =>  'require',
	    'address'        =>  'require',
        'tel'        =>  'require',
        'opening_bank'        =>  'require',
        'bank_number'         =>  'require',
        'service_name'        =>  'require',
        'model'        =>  'require',
        'model_unit'        =>  'require',
        'num'        =>  'require',
        'price'        =>  'require',
        'money'        =>  'require',
        'tax_rate'        =>  'require',
        'tax_amount'        =>  'require'
    ];
    protected $message = [
        'title.require'    =>  '发票抬头不能为空',
        'title.unique'      =>'该发票已存在',
	    'dentify_number.require'  =>  '纳税人识别号不能为空',
	    'address.require'    =>  '地址不能为空',
        'tel.require'    =>  '电话不能为空',
        'opening_bank.require'    =>  '开户行不能为空',
        'bank_number.require'    =>  '账号不能为空',
        'service_name.require'    =>  '请填写服务名称',
        'model.require'    =>  '请填写规格型号',
        'model_unit.require'    =>  '请填写单位',
        'num.require'    =>  '请填写数量',
        'price.require'    =>  '请填写单价',
        'money.require'    =>  '请填写金额',
        'tax_rate.require'    =>  '请填写税率',
        'tax_amount.require'    =>  '请填写税额'
    ];

    protected $scene = [
        'add'  => [ 'title' , 'dentify_number' , 'address'  , 'tel'  , 'opening_bank'  , 'bank_number'  , 'service_name' , 'model' , 'model_unit' , 'num' , 'price' , 'money' , 'tax_rate','tax_amount'],
        'edit' => [ 'title' , 'dentify_number' , 'address'  , 'tel'  , 'opening_bank'  , 'bank_number'  , 'service_name' , 'model' , 'model_unit' , 'num' , 'price' , 'money' , 'tax_rate','tax_amount']
    ];
}